using System;

namespace Mbs.ComponentModel
{
    public class SimpleUndoAction : UndoAction
    {
        public Action UndoHandler { get; set; }
        public Action RedoHandler { get; set; }

        public override void Undo()
        {
            if (UndoHandler != null)
                UndoHandler();
        }

        public override void Redo()
        {
            if (RedoHandler != null)
                RedoHandler();
        }

        protected override void Dispose(bool disposing)
        {
            UndoHandler = null;
            RedoHandler = null;
            base.Dispose(disposing);
        }
    }
}
